using System.ComponentModel.DataAnnotations;
using Framework.SqlDataAccess.Model;

namespace Kaysite.Model
{
    public class Office: KaysiteModel
    {
        [DBMaping(PrimaryKey = true)]
        [Required]
        public int OfficeID { get; set; }

        [DBMaping]
        [Required]
        public eRegion RegionID { get; set; }

        [DBMaping]
        [Required]
        [StringLength(256)]
        [DBFieldInfo(IsName = true)]
        public string OfficeName { get; set; }

        [DBMaping]
        [Required]
        [StringLength(256)]
        public string City { get; set; }

        [DBMaping]
        [Required]
        [StringLength(512)]
        public string Address { get; set; }

        [DBMaping]
        [StringLength(512)]
        public string Address2 { get; set; }

        [DBMaping]
        [StringLength(36)]
        public string Phone1 { get; set; }

        [DBMaping]
        [StringLength(36)]
        public string Phone2 { get; set; }

        [DBMaping]
        [StringLength(36)]
        public string Phone3 { get; set; }

        [DBMaping]
        [StringLength(36)]
        public string Phone4 { get; set; }

        [DBMaping]
        [Required]
        public eDisplayOption DisplayInMain { get; set; }

        [DBMaping]
        public double? Lat { get; set; }

        [DBMaping]
        public double? Lng { get; set; }

        public string Region { get { return RegionID.GetName(); } }

        public Office()
        {
            DisplayInMain = eDisplayOption.Hide;
        }

        public OfficeMarker GetMarker()
        {
            return new OfficeMarker
                   {
                       City = City,
                       Lat = Lat,
                       Lng = Lng
                   };
        }

    }

    public class OfficeMarker
    {
        public string City { get; set; }
        public double? Lat { get; set; }
        public double? Lng { get; set; }
    }
}